/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * TrainingBook
 * Copyright (C) Arnaud Duval 2010 <arnaud.duval@gmail.com>
 * 
 * Projects is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Projects is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _INTERVAL_HPP_
#define _INTERVAL_HPP_

#include <DateTime.hpp>
#include <Duration.hpp>



///@class Interval
///@brief Defines an interval
class Interval
{
    private:
        ///@brief DateTime corresponding to the beginning of interval
        DateTime startDateTime;
        ///@brief Duration of the interval
        Duration duration;
        ///@brief Name of the interval
        std::string name;
        ///@brief Distance of the interval
        double distance;
    
    
    public:
        ///@brief Default constructor
        Interval();
        ///@brief Copy constructor
        Interval(const Interval&);
        ///@brief Constructor with arguments
        Interval(DateTime, Duration, std::string);
        ///@brief Destructor
        ~Interval();
        ///@brief Overload of = operator
        Interval& operator=(const Interval&);
        
        /// GETTERS
        ///@brief Return interval duration
        Duration GetDuration() const;
        ///@brief Return start DateTime
        DateTime GetStartDateTime() const;
        ///@brief Return end DateTime
        DateTime GetEndDateTime() const;
        ///@brief Return name
        std::string GetName() const;
        ///@brief Return distance
        double GetDistance() const;
        
        /// SETTERS
        ///@brief Set the interval duration
        void SetDuration(Duration);
        ///@brief Set the start DateTime
        void SetStartDateTime(DateTime);
        ///@brief Set the name
        void SetName(std::string);
        ///@brief Set distance
        void SetDistance(double);
        
        ///WRITE IN DIFFERENT TYPES OF FILE
        ///@brief Write to XML native file
        void WriteXML(std::ofstream &fout);
    
};

#endif